Skip to content

Rules findings never stall a run: new items judged by structure, and a wait on a person always names what for - #488

Merged
nambok merged 1 commit into
mainfrom
fix/rules-sibling-structure
Nov 6, 2026
Merged

nambok merged 1 commit into
mainfrom
fix/rules-sibling-structure

Conversation

@nambok

@nambok nambok commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

A run did all its tasks, passed the code generator and the security audit, and was then blocked by the new-feature rules: a new <name>-validation.ts module (validation predicates only, no schema) next to the schema documents was treated as an unregistered document. The run opened a draft PR with that as its open item and was set to needs_input with no question. Nothing asked anyone anything, and it waited three days while its PR only needed a review.

This fixes both halves:

  1. Siblings by structure, not folder. A new file is a new item of its siblings' kind only when its export shape matches theirs (default export, the definer they all call such as defineType(...), base class, trait, decorator) and the shape the registries import them by (a registry that imports each sibling's default export needs one from the new file). Helpers, validators, utilities, types and generated files beside them are not items. When the structure can't tell, the places are noted for a person, never a block.
  2. A wait on a person always names what for. Every needs_input write now carries waiting_on: the questions to answer, or one named action (review pull request #n with what is open, answer an approval, add the missing detail to the ticket). The only way to write the status is run_wait::NeedsInput::needs_input, and a test reads the worker and gateway sources so no write sets it any other way. A run stopped after its work now waits for its PR's review by name.
  3. Never silent. The stuck-run sweep now reads needs_input runs: one that names nothing is reported (run_waiting_unasked, metric + alarm), given a named wait (its PR's review, else a Retry with its reason), and notified. A run still waiting REMIND_AFTER_HOURS (24) after its wait started gets one reminder through the usual run.needs_input event.

Rules findings were already Open items rather than stops since #485 (feature::gate's error becomes proof::blocked_item and the run continues to awaiting_ci); this keeps that and closes the remaining needs_input-with-nothing paths (stop_pr, run guard, own-review stop, planned-work stop, approval timeout, ceiling, reopen).

Changes

  • worker/passes/feature/registration.rs: Shape, shape, imports_default, kind_of (Same / Other / Unknown), judge; types and generated files are never items; Unknown turns places into notes.
  • common/src/run_wait.rs (new): WaitingOn, asks_something, reminder_due, REMIND_AFTER_HOURS, the NeedsInput write, and the source test.
  • Every needs_input write (passes/mod.rs, stop_pr.rs, run_guard.rs, resume.rs via wait_for_review, agent/policy.rs, gateway/routes/run_close.rs reopen) names its wait.
  • gateway/routes/api.rs: waiting_on on the run (OpenAPI regenerated). webhooks.rs: the run.needs_input event's error says what the run waits for.
  • run_waiting worker message (contract, DLQ list): the sweep's reminder and named-wait notice, sent as run.needs_input.
  • lambda/stuck-run-cleanup: reads needs_input runs, names empty waits, reminds once; the over-ceiling stop names its wait. Infra: TICKET_QUEUE_URL + send grant for the sweep, RunWaitingUnasked metric and alarm.

Verification

  • cargo fmt --all --check, cargo clippy -p worker -p common -p gateway --all-targets -D warnings: clean.
  • cargo test -p worker -p common -p gateway: all pass (worker 1444, common 735, gateway 1297).
  • python3 -m unittest discover -s lambda/tests: 360 pass.
  • New tests: a validation helper beside schema documents gives no block; a real new schema document not registered is still flagged in both registries (declared then exported by name too); an unreadable file or siblings with no shared shape give notes only; shapes in TS, CJS, Python and Rust; registries importing defaults; needs_input can't be written without a wait (source test) and a wait is never blank; the sweep finds a stalled run with a PR, hands it to review and notifies; one reminder per wait; the sweep's message matches the worker contract.

…a wait on a person always names what for

The registration rule counted any new file in a folder as a sibling that
must be registered, so a validation helper beside schema documents blocked
the pull request. A new file is now an item of its siblings' kind only when
its export shape matches theirs and the registries' imports; when that can't
be told, its places are only noted.

A run that stopped after its work was set to needs_input with nothing asked
and sat silently. Every needs_input write now carries a named wait (its
questions, or an action such as reviewing its pull request), shown on the
run page and in the run.needs_input event. The stuck-run sweep names any
wait that names nothing, alarms on it, and sends one reminder after 24 hours.
@nambok
nambok force-pushed the fix/rules-sibling-structure branch from f447b82 to 090f240 Compare November 6, 2026 14:47
@nambok
nambok merged commit 8e88509 into main Nov 6, 2026
10 checks passed
@nambok
nambok deleted the fix/rules-sibling-structure branch November 6, 2026 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant